package testGroovy

import org.cyberneko.html.parsers.SAXParser

def file = 'src/main/resources/input.html' as File
println file.isFile()

if(file.exists()) {
	def dom = htmlParser.parse(file).depthFirst()
	println dom.size()
	
	def carInfoMap = dom.INPUT.collect { input -> 
		if('hidden' == input.@type || 'text' == input.@type) {
			[ (input.@id): input.@value ?: '' ]
		}
	} - null
	def map = carInfoMap.inject { prev, curr ->
		prev + curr
	}
	carInfoMap.each { entry ->
		println entry
	}
	println carInfoMap instanceof List
	println map instanceof Map
	println map.hidCurDate
}


def getHtmlParser() {
	def nekoParser = new SAXParser().with {
		setFeature 'http://xml.org/sax/features/namespaces', false
		it
	}
	new XmlParser(nekoParser)
}